﻿using System;
using System.Collections.Generic;
using System.Text;

namespace iToolPlugin.SMSProvider
{
    public class SmsBase
    {
        protected int appid
        {
            get;
        }

        protected string appkey
        {
            get;
        }

        protected IHTTPClient httpclient
        {
            get;
            set;
        }

        public SmsBase(int appid, string appkey, IHTTPClient httpclient)
        {
            this.appid = appid;
            this.appkey = appkey;
            this.httpclient = httpclient;
        }

        public HTTPResponse handleError(HTTPResponse response)
        {
            if (response.statusCode < 200 || response.statusCode >= 300)
            {
                throw new HTTPException(response.statusCode, response.reason);
            }

            return response;
        }
    }
}
